import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Nav from "../components/find/nav";
import Recommend from "../components/find/recommend";
import Rank from "../components/find/rank";
import Song from "../components/find/song";
import List from "../components/playlist/list";
import Usrinfo from "../components/user/userinfo.vue";
import hotcomment from "../components/playlist/hotcomment";
import Mylove from "../components/mylove.vue";
import SearchInfo from "../components/search/searchInfo";
import Songs from "../components/song";
import Mysong from "../components/song/mysong";
import myAlbum from "../components/song/myAlbum";
import Albuminfo from "../components/song/albuminfo";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    component: Home,
    redirect: "/find/recommend",
  },
  {
    path: "/serch/:keywords",
    component: SearchInfo,
  },
  {
    path: "/find",
    component: Nav,
    redirect: "/find/recommend",
    children: [
      {
        path: "recommend",
        component: Recommend,
      },
      {
        path: "song",
        component: Song,
      },
      {
        path: "rank",
        component: Rank,
      },
    ],
  },
  {
    name: "playlist",
    path: "/playlist/:id",
    component: List,
    meta: {
      keepAlive: true, // 是否启用keepAlive
    },
  },
  {
    name: "hot",
    path: "/hot/:id/:type",
    component: hotcomment,
  },
  {
    path: "/user/:id",
    component: Usrinfo,
  },
  {
    path: "/mylove",
    component: Mylove,
  },
  {
    path: "/songs/:id",
    component: Songs,
  },
  {
    path: "/singer",
    component: Mysong,
  },
  {
    path: "/station",
    component: myAlbum,
  },
  {
    path: "/albuminfo/:id",
    component: Albuminfo,
  },
  {
    path: "/personal",
    component: Nav,
    children: [{ path: "/", component: Recommend }],
  },
  {
    path: "/mv",
    component: Nav,
    children: [{ path: "/", component: Recommend }],
  },
  {
    path: "/friend",
    component: Nav,
    children: [{ path: "/", component: Recommend }],
  },
  
];

const router = new VueRouter({
  routes,
});

export default router;
